#ifndef _HMC5983_H
#define _HMC5983_H
#include "stm32f10x.h"
#include "math.h"
/*
bilibili 小努班 UID:437280309
@time时间: 2025.8.6
@version版本:V1_2
@Encoding :UTF-8
@attention : 无！

if you can't display Chinese correctly,please check your encoding mode(please set encoding mode to UTF-8)
*/

#define HMC5983_Address 0x1E//当SD0接高电平时 while the SD0 connect to HIGH
extern int16_t calibration_x;
extern int16_t calibration_y;

typedef struct HMC5983
{
    int16_t XMag;
    int16_t YMag;
    int16_t ZMag;
}HMC5983_Typedef;
///////////////////////////////以上操作是参数选择//////////////////////////////////////////////

/////////////////////////User//////////////////////////////////
void HMC5983_Init(GPIO_TypeDef* GPIOx,uint16_t SCL,uint16_t SDA);
float HMC5983_Get_temp(void);//读取温度
float HMC5983_Get_Angle(void);//得到方位角
void HMC5983_calibration(void);//校准

//Add 增添操作，意味着这不常用
uint8_t HMC5983_Status(void);//返回芯片工作状态
void HMC5983_Get_Data(HMC5983_Typedef* HMC5893_ptr);//读取磁力原始数据

/////////////////////////Administrator//////////////////////////////////
uint8_t HMC5983_RegA_ID(void);
uint8_t HMC5983_RegB_ID(void);
uint8_t HMC5983_RegC_ID(void);

#endif
